import { createApp } from 'vue'
import { createPinia } from 'pinia'
import piniaPluginPersistedstate from "pinia-plugin-persistedstate";

import ElementPlus from "element-plus";
import "element-plus/dist/index.css";
import * as ElementPlusIconsVue from "@element-plus/icons-vue";
import zhCn from 'element-plus/es/locale/lang/zh-cn'

import App from './App.vue'
import router from './router'
import { useUserStore } from './stores/userStore';

// import "./mock/index.ts"; // mock 方式，正式发布时，注释掉该处即可

const app = createApp(App)
const pinia = createPinia();

pinia.use(piniaPluginPersistedstate);
app.use(pinia)

const userStore=useUserStore()
userStore.setRoutes()

app.use(ElementPlus, { size: "large", locale: zhCn, zIndex: 3000 });
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component);
}

app.use(router)

app.mount('#app')
